package com.etc;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @Auther: zhezhe
 * @Date: 2018/10/1914:31
 * @Description:
 */
public class ReducerTest extends Reducer<Text,IntWritable,Text,IntWritable> {
    @Override
    protected void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        int i = 0;
        for (IntWritable value : values) {
            i = i + value.get();
        }
        context.write(key,new IntWritable(i));
    }
}
